import axios from "axios";
import { ElMessage } from "element-plus";
//创建axios实例
let request = axios.create({
    baseURL: 'http://localhost:8080',
    timeout: 1000
})
//请求拦截器
request.interceptors.request.use(config => {
    return config;
});
//响应拦截器
request.interceptors.response.use((response) => {
    return response.data;
}, (error) => {
    ElMessage({
        type: 'error',
        message: '服务器错误'
    })
    return Promise.reject(error);
});
export default request;